Robotics 1.0 Lesson Plan
Lesson 18: Slide Away

Purpose: Show how a servo driven rack and pinion converts rotary motion into linear sliding motion.

No. of. Classes

1 - (Time : 1:30 minutes, each group maximum 4 children).

Materials Required

Desktop or laptop computer, CPX board, Crickit, USB cable, 5V battery

MG995 servo motor

Rack and pinion gear set

Jumper wires

2 limit switches (for left and right ends)

Prior knowledge

Basic understanding of the CPX and Crickit boards
How servo motors work and move to different angles
How to upload CircuitPython code using the Mu Editor
How to safely use external power for motors.

Exercises

Exercise:1



Setting up the rack and pinion with the MG995 Servo motor


  • Click here to view the video on assembling the rack and pinion with the servo motor
  • Click here to view the connection diagram for MG995 servo motor
  • Run the servo motor and view how the rack and pinion motion happens. Use this sample code for reference
  • Exercise:2



    Adding limit switches to either end of the slider


  • Learn how to solder wires to the limit switch safely using this video
  • Click here to view the connection diagram for the limit switch. Fix the limit switches to either end of the slider and connect them to the sensor I/O ports of your choice.
  • Test the limit switch using this sample code
  • Exercise:3



  • Implement the logic in pseudocode to make the rack move over the slider and stop at the ends when it hits the limit switch
  • Solution



  • Click here to see the solution video for Exercise 3.
  • Click here to see the code for Exercise 3.
  • Click here to see the code explanation for Exercise 3.
  • Teacher's Instruction
    1. Explain the objective of the activity, which is to convert rotary motion from a servo into linear sliding motion using a rack and pinion.
    2. Introduce the required materials including the CPX, Crickit, MG995 servo motor, rack and pinion, limit switches, and external 5V power.
    3. Explain why the MG995 servo needs a separate 5V supply from the NeoPixel 5V and GND pins instead of the Crickit servo port.
    4. Explain that what we are using in this lesson is a continuous servo motor as compared to a 180 or 90 degree servo motor. Show the sample code in exercise 1 to demo how we use different libraries for continuous servo motors
    5. Show how to connect the servo signal wire to Crickit and the power and ground wires to the 5V and GND pins.
    6. Explain how the servo rotates the pinion gear and moves the rack to create sliding motion.
    7. Demonstrate how the limit switches stop the rack when it reaches the left or right end.
    8. Guide students on safely soldering wires to the limit switches and connecting them to the CPX or Crickit.
    9. Demonstrate the CircuitPython code that reads the limit switches and controls the servo movement. Discuss the different input modes like INPUT_PULLUP, INPUT_PULLDOWN etc for sensors
    10. Provide step by step guidance and help students troubleshoot wiring and movement issues.
    11. If the rack is carrying a heavy load, how would that change the choice of servo, gear size, or power supply in this system?
    12. How can we use sensors or feedback to know the exact position of the sliding rack instead of knowing only when it reaches the ends?